///<reference path="./typings/jquery/jquery.d.ts"/>
///<reference path="./typings/sharepoint/sharepoint.d.ts"/>
///<reference path="./typings/requirejs/require.d.ts"/>
///<reference path="./modules/utilities.ts"/>
///<reference path="./modules/Taxonomy.ts"/>

import m_Util = require("modules/utilities");
import m_Tax = require("modules/Taxonomy");

export class App extends m_Util.Utilities.AsyncObserver {

    constructor() {
        super();

        // Dependency of type SP.Taxonomy.TermStore
        var termStore = m_Tax.Taxonomy.Dependencies.GetTermStore("Managed Metadata Service");
        this.ApplyBinding(termStore);
        
        // Dependency of type SP.Taxonomy.TermGroup
        var termGroup = m_Tax.Taxonomy.Dependencies.GetTermGroup(termStore, "DMS");
        this.ApplyBinding(termGroup);
        
        // Create a typed Dependency
        var termSet = m_Tax.Taxonomy.Dependencies.GetTermSet(termGroup, "Languages");
        this.ApplyBinding(termSet);
        
        // Now put the wheel in motion
        if (this.MoveNext()) {
            this.ResolveCurrent();
        }

    }
}

jQuery(document).ready(function () {
    var app: App = new App();
});